      * GRUPO 03 DE ALGORITMOS Y PROGRAMACION IV (7527).
      * FACULTAD DE INGENIERIA DE LA UNIVERSIDAD DE BUENOS AIRES.
      * ARCHIVO PARA TODAS LAS DEFINICIONES
       IDENTIFICATION DIVISION.
       PROGRAM-ID. TPALGOIV.
       AUTHOR. BASUALDO - CUEVAS - MONTES - ROMERO.
      *---------------------------------------------------------- *
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
            DECIMAL-POINT IS COMMA.
      *---------------------------------------------------------- *
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
            SELECT RESERV1          
               ASSIGN TO 'C:\RES1.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-RES1.
            SELECT RESERV2          
               ASSIGN 'C:\RES2.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-RES2.
            SELECT RESERV3          
               ASSIGN 'C:\RES3.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-RES3.
            SELECT RESERVIP        
               ASSIGN 'C:\VIP.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-VIP.
            SELECT ESTADIAS
               ASSIGN TO 'C:\EST.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-EST.
            SELECT CATGRIAS          
               ASSIGN TO  'C:\CAT.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-CAT.
            SELECT DSCENTOS
               ASSIGN TO 'C:\DESC.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-DESC.
            SELECT MAESTRO              
               ASSIGN TO 'C:\MAESTRO.DAT'
			   ORGANIZATION IS LINE SEQUENTIAL
               FILE STATUS IS WSS-FS-MAESTRO.
            SELECT REPORTE 
               ASSIGN TO 'C:\REPO.DAT'
               FILE STATUS IS WSS-FS-REPORTE.
            SELECT MATRIZ 
               ASSIGN TO 'C:\MATRIZ.DAT'
               FILE STATUS IS WSS-FS-MATRIZ.
      *---------------------------------------------------------- *
       DATA DIVISION.
       FILE SECTION.
        FD RESERV1           DATA RECORD IS RES1
                LABEL RECORD IS STANDARD.
        01 REG-RES1.
           05 REG-RES1-CLAVE.
              10 REG-RES1-COD-RES       PIC 9(6).
              10 REG-RES1-DIGITO        PIC 9.
           05 REG-RES1-FECHA-DES.
              10 REG-RES1-ANIO-DES      PIC X(4).
              10 FILLER                 PIC X.
              10 REG-RES1-MES-DES       PIC X(2).
              10 FILLER                 PIC X.
              10 REG-RES1-DIA-DES       PIC X(2).
           05 REG-RES1-FECHA-HAS.
              10 REG-RES1-ANIO-HAS      PIC X(4).
              10 FILLER                 PIC X.
              10 REG-RES1-MES-HAS       PIC X(2).
              10 FILLER                 PIC X.
              10 REG-RES1-DIA-HAS       PIC X(2).
           05 REG-RES1-CATEG-HAB        PIC 9(4).
           05 REG-RES1-DATOS-PERS.
              10 REG-RES1-NOMBRE-CLI    PIC X(30).
              10 REG-RES1-TEL           PIC X(15).
              10 REG-RES1-DIR           PIC X(30).
           05 REG-RES1-IMP-RES          PIC S9(06)V99.
      *****************************
        FD RESERV2           LABEL RECORD IS STANDARD
                                DATA RECORD IS RES2.
         01 REG-RES2.
            05 REG-RES2-CLAVE.
               10 REG-RES2-COD-RES       PIC 9(6).
               10 REG-RES2-DIGITO        PIC 9.
            05 REG-RES2-FECHA-DES.
               10 REG-RES2-ANIO-DES      PIC X(4).
               10 FILLER                 PIC X.
               10 REG-RES2-MES-DES       PIC X(2).
               10 FILLER                 PIC X.
               10 REG-RES2-DIA-DES       PIC X(2).
            05 REG-RES2-FECHA-HAS.
               10 REG-RES2-ANIO-HAS      PIC X(4).
               10 FILLER                 PIC X.
               10 REG-RES2-MES-HAS       PIC X(2).
               10 FILLER                 PIC X.
               10 REG-RES2-DIA-HAS       PIC X(2).
            05 REG-RES2-CATEG-HAB        PIC 9(4).
            05 REG-RES2-DATOS-PERS.
               10 REG-RES2-NOMBRE-CLI    PIC X(30).
               10 REG-RES2-TEL           PIC X(15).
               10 REG-RES2-DIR           PIC X(30).
            05 REG-RES2-IMP-RES          PIC S9(06)V99.
      *****************************
        FD RESERV3           LABEL RECORD IS STANDARD
                                DATA RECORD IS RES3.
         01 REG-RES3.
            05 REG-RES3-CLAVE.
               10 REG-RES3-COD-RES       PIC 9(6).
               10 REG-RES3-DIGITO        PIC 9.
            05 REG-RES3-FECHA-DES.
               10 REG-RES3-ANIO-DES      PIC X(4).
               10 FILLER                 PIC X.
               10 REG-RES3-MES-DES       PIC X(2).
               10 FILLER                 PIC X.
               10 REG-RES3-DIA-DES       PIC X(2).
            05 REG-RES3-FECHA-HAS.
               10 REG-RES3-ANIO-HAS      PIC X(4).
               10 FILLER                 PIC X.
               10 REG-RES3-MES-HAS       PIC X(2).
               10 FILLER                 PIC X.
               10 REG-RES3-DIA-HAS       PIC X(2).
            05 REG-RES3-CATEG-HAB        PIC 9(4).
            05 REG-RES3-DATOS-PERS.
               10 REG-RES3-NOMBRE-CLI    PIC X(30).
               10 REG-RES3-TEL           PIC X(15).
               10 REG-RES3-DIR           PIC X(30).
            05 REG-RES3-IMP-RES          PIC S9(06)V99.
      *****************************
        FD RESERVIP         LABEL RECORD IS STANDARD
                                DATA RECORD IS VIP.
         01 REG-RES-VIP.
            05 REG-RES-VIP-CLAVE.
               10 REG-RES-VIP-COD-RES       PIC 9(6).
               10 REG-RES-VIP-DIGITO        PIC 9.
            05 REG-RES-VIP-FECHA-DES.
               10 REG-RES-VIP-ANIO-DES      PIC X(4).
               10 FILLER                    PIC X.
               10 REG-RES-VIP-MES-DES       PIC X(2).
               10 FILLER                    PIC X.
               10 REG-RES-VIP-DIA-DES       PIC X(2).
            05 REG-RES-VIP-FECHA-HAS.
               10 REG-RES-VIP-ANIO-HAS      PIC X(4).
               10 FILLER                    PIC X.
               10 REG-RES-VIP-MES-HAS       PIC X(2).
               10 FILLER                    PIC X.
               10 REG-RES-VIP-DIA-HAS       PIC X(2).
            05 REG-RES-VIP-CATEG-HAB        PIC 9(4).
            05 REG-RES-VIP-DATOS-PERS.
               10 REG-RES-VIP-NOMBRE-CLI    PIC X(30).
               10 REG-RES-VIP-TEL           PIC X(15).
               10 REG-RES-VIP-DIR           PIC X(30).
            05 REG-RES-VIP-IMP-RES          PIC S9(06)V99.
      *****************************
       FD ESTADIAS        DATA RECORD IS EST
                LABEL RECORD IS STANDARD.
        01 EST                          PIC X(28).
      *****************************
       FD CATGRIAS        DATA RECORD IS CAT
                LABEL RECORD IS STANDARD.
        01 CAT                          PIC X(19).
      *****************************
       FD DSCENTOS        DATA RECORD IS DESC
                LABEL RECORD IS STANDARD.
        01 DESC                         PIC X(12).
      *****************************
       FD MAESTRO        DATA RECORD IS MAE
                LABEL RECORD IS STANDARD.
        01 MAE                          PIC X(115).
      *****************************
       FD  REPORTE
                                 DATA RECORD IS REGISTRO-REPORTE.
        01 REGISTRO-REPORTE                    PIC X(101).
      *****************************
       FD  MATRIZ
                                 DATA RECORD IS REGISTRO-MATRIZ.
        01 REGISTRO-MATRIZ                     PIC X(811).
      *---------------------------------------------------------- *
       WORKING-STORAGE SECTION.
      *-------------------- CONSTANTES ------------------------- *
        01 CONSTANTES.
           05 WSC-MAX-LINEA            PIC 9(02) VALUE 60.
           05 WSC-N-1                  PIC 9(01) VALUE 1.
           05 WSC-N-10                 PIC 9(02) VALUE 10.
      *-------------------- VARIABLES -------------------------- *
        01 TABLA-CATGRIAS.
           05 WSV-TABLA-CATGRIAS              OCCURS 10.
              10  WSV-TBL-CAT-HB                PIC 9(4).
              10  WSV-TBL-CAT-DESC              PIC X(15).
        01 WSV-TBL-HLD.
           05  WSV-CAT-HB-HLD                   PIC 9(4).
           05  WSV-CAT-DESC-HLD                 PIC X(15).
        01 VARIABLES.
           05 WSV-MATRIZ-ESTADISTICAS.
              10 WSV-COLUMNA-MESES OCCURS 12 TIMES.
                 15 WSV-FILA-CATGRIAS OCCURS 50 TIMES.
                    20 WSV-IMPORTE-MATRIZ       PIC 9(09)V99.
        01 WSV-FECHA-DEL-DIA.
           05 WSV-FECHA-DEL-DIA-AAAA           PIC X(04).
           05 WSV-FECHA-DEL-DIA-MM             PIC X(02).
           05 WSV-FECHA-DEL-DIA-DD             PIC X(02).
        77 WS-DESC                             PIC S9(06)V9(02).
      *-------------------- INDICES ---------------------------- *
        01 INDICES.
           05 WSI-I                            PIC 9(2) VALUE 1.
           05 WSI-J                            PIC 9(2) VALUE 1.
           05 WSI-SUB                          PIC 9(2) VALUE 1.
           05 WSI-X                            PIC 9(2) VALUE 1.
           05 WSI-Y                            PIC 9(2) VALUE 1.
           05 WSI-MES                          PIC 9(2).
           05 WSI-CATEGORIA                    PIC 9(2).
           05 WSI-LINEA                        PIC 9(2).
           05 WSI-PAGINA                       PIC 9(04).
      *-------------------- SWITCHES --------------------------- *
        01 SWITCHES.
           05 WSS-FS-RES1                      PIC X(2).
              88 WSS-FS-RES1-OK                  VALUE '00'.
               88 WSS-FS-RES1-EOF                VALUE '10'.
           05 WSS-FS-RES2                      PIC X(2).
              88 WSS-FS-RES2-OK                  VALUE '00'.
              88 WSS-FS-RES2-EOF                 VALUE '10'.           
           05 WSS-FS-RES3                      PIC X(2).
              88 WSS-FS-RES3-OK                  VALUE '00'.
              88 WSS-FS-RES3-EOF                 VALUE '10'.
           05 WSS-FS-VIP                       PIC X(2).
              88 WSS-FS-VIP-OK                   VALUE '00'.
              88 WSS-FS-VIP-EOF                  VALUE '10'.
           05 WSS-FS-EST                       PIC X(2).
              88 WSS-FS-EST-OK                   VALUE '00'.
              88 WSS-FS-EST-EOF                  VALUE '10'.
           05 WSS-FS-CAT                       PIC X(2).
              88 WSS-FS-CAT-OK                   VALUE '00'.
              88 WSS-FS-CAT-EOF                  VALUE '10'.
           05 WSS-FS-DESC                      PIC X(2).
              88 WSS-FS-DESC-OK                  VALUE '00'.
              88 WSS-FS-DESC-EOF                 VALUE '10'.
           05 WSS-FS-MAESTRO                   PIC X(2).
              88 WSS-FS-MAESTRO-OK               VALUE '00'.
              88 WSS-FS-MAESTRO-EOF              VALUE '10'.
           05  WSS-FS-REPORTE                  PIC X(2) .
              88 WSS-FS-REPORTE-OK               VALUE '00'.
              88 WSS-FS-REPORTE-FIN              VALUE '10'.
           05  WSS-FS-MATRIZ                   PIC X(2) .
              88 WSS-FS-MATRIZ-OK                VALUE '00'.
              88 WSS-FS-MATRIZ-FIN               VALUE '10'.
      *----------------------------
      * LA CLAVE MENOR *****
        01 WS-MENOR.
           05 WS-MENOR-COD-RES            PIC 9(6).
           05 WS-MENOR-DIGITO             PIC 9.
        
      * --- CONTADORES DE LECTURAS ---*
       01 WSV-CONTADORES.
       05 WSV-LEIDOS-RES1              PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-RES2              PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-RES3              PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-VIP               PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-EST               PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-CAT               PIC 9(04) VALUE 0.
       05 WSV-LEIDOS-DESC              PIC 9(04) VALUE 0.
       
      *-------------------- REGISTROS -------------------------- *
        01 WS-REG-EST.
           05 WS-REG-EST-CLAVE.
              10 WS-REG-EST-COD-RES       PIC 9(6).
              10 WS-REG-EST-DIGITO        PIC 9.
           05 WS-REG-EST-FECHA-DES.
              10 WS-REG-EST-ANIO-DES      PIC X(4).
              10 FILLER                   PIC X.
              10 WS-REG-EST-MES-DES       PIC X(2).
              10 FILLER                   PIC X.
              10 WS-REG-EST-DIA-DES       PIC X(2).
           05 WS-REG-EST-FECHA-HAS.
              10 WS-REG-EST-ANIO-HAS      PIC X(4).
              10 FILLER                   PIC X.
              10 WS-REG-EST-MES-HAS       PIC X(2).
              10 FILLER                   PIC X.
              10 WS-REG-EST-DIA-HAS       PIC X(2).
           05 WS-REG-EST-CATEG-HAB        PIC 9(4).
           05 WS-REG-EST-IMPORTE          PIC S9(06)V9(2).
      *------------------
        01 WS-REG-DESC.
           05 WS-REG-DESC-CLAVE.
              10 WS-REG-DESC-COD-RES      PIC 9(6).
              10 WS-REG-DESC-DIG          PIC 9.
           05 WS-REG-DESC-PORC            PIC 9(3)V9(2).
      *-----------------
        01 WS-REG-MAE.
           05 WS-REG.
              10 WS-REG-MAE-CLAVE.
                 15 WS-REG-MAE-COD-RES       PIC 9(6).
                 15 WS-REG-MAE-DIGITO        PIC 9.
              10 WS-REG-MAE-FECHA-DES.
                 15 WS-REG-MAE-ANIO-DES      PIC X(4).
                 15 FILLER                   PIC X.
                 15 WS-REG-MAE-MES-DES       PIC X(2).
                 15 FILLER                   PIC X.
                 15 WS-REG-MAE-DIA-DES       PIC X(2).
              10 WS-REG-MAE-FECHA-HAS.
                 15 WS-REG-MAE-ANIO-HAS      PIC X(4).
                 15 FILLER                   PIC X.
                 15 WS-REG-MAE-MES-HAS       PIC X(2).
                 15 FILLER                   PIC X.
                 15 WS-REG-MAE-DIA-HAS       PIC X(2).
              10 WS-REG-MAE-CATEG-HAB        PIC 9(4).
              10 WS-REG-MAE-DATOS-PERS.
                 15 WS-REG-MAE-NOMBRE-CLI    PIC X(30).
                 15 WS-REG-MAE-TEL           PIC X(15).
                 15 WS-REG-MAE-DIR           PIC X(30).
              10 WS-REG-MAE-IMP              PIC S9(06)V99.
              10 WS-REG-MAE-ESTADO           PIC X.
      *---------------------
        01 WS-REG-CAT.
           03 WS-REG-CAT-HAB              PIC 9(4).
           03 WS-REG-CAT-DESCRIP          PIC X(15).
      *---------------------
        01  REGISTRO-ARCHIVO-REPORTE.
           05 WSV-LINEA-UNO.
              10 FILLER                    PIC X(07) VALUE 'FECHA: '.
              10 WSV-FECHA-LISTADO-RESERVAS.
                 15 WSV-FEC-LISTADO-RESERVAS-AAAA PIC X(04).
                 15 FILLER                        PIC X(01) VALUE '/'.
                 15 WSV-FEC-LISTADO-RESERVAS-MM   PIC X(02).
                 15 FILLER                        PIC X(01) VALUE '/'.
                 15 WSV-FEC-LISTADO-RESERVAS-DD   PIC X(02).
              10 FILLER                           PIC X(79).
              10 WSV-HOJA-NRO.
                 15 FILLER  PIC X(10) VALUE 'HOJA NRO: ' .
                 15 WSV-NUMERO-HOJA               PIC Z(02).
           05 WSV-SEPARADO-UNO                    PIC X(80).
           05 WSV-LINEA-DOS.
              10 FILLER                     PIC X(41).
              10 FILLER  PIC X(19) VALUE 'LISTADO DE ESTADIAS' .
              10 FILLER                     PIC X(41).
           05 WSV-LINEA-TRES.
             10 FILLER                 PIC X(07) VALUE 'COD RES'.
             10 FILLER                 PIC X(01) VALUE SPACES.
             10 FILLER                 PIC X(03) VALUE 'DIG'.
             10 FILLER                 PIC X(01) VALUE SPACES.
             10 FILLER                 PIC X(10) VALUE 'FEC. DESDE'.
             10 FILLER                 PIC X(01) VALUE SPACES.
             10 FILLER                 PIC X(10) VALUE 'FEC. HASTA'.
             10 FILLER                 PIC X(04) VALUE SPACES.
             10 FILLER                 PIC X(09) VALUE 'CATEGORIA'.
             10 FILLER                 PIC X(06) VALUE SPACES.
             10 FILLER                 PIC X(07) VALUE 'IMPORTE'.
             10 FILLER                 PIC X(12) VALUE SPACES.
             10 FILLER                 PIC X(30) VALUE 'NOMBRE CLIENTE'.
          05 WSV-LINEA-CUATRO.
             10 WSV-CODIGO                       PIC X(06).
             10 FILLER                           PIC X(01).
             10 WSV-DIGITO                       PIC X(01).
             10 FILLER                           PIC X(01).
             10 WSV-FEC-DES                      PIC X(10).
             10 FILLER                           PIC X(01).
             10 WSV-FEC-HAS                      PIC X(10).
             10 FILLER                           PIC X(01).
             10 WSV-CATEGORIA                    PIC X(15).
             10 FILLER                           PIC X(01).
             10 WSV-IMPORTE                      PIC $$$.$$9,99.
             10 FILLER                           PIC X(01).
             10 WSV-NOMB-CLIE                    PIC X(30).
       01  REGISTRO-ARCHIVO-MATRIZ.
          05 WSV-LINEA-0.
             10 FILLER                  PIC X(15) VALUE ALL '#'.
             10 WSV-CABECERA-MATRIZ OCCURS 50 TIMES.
                15 WSV-CATEGORIA-SALIDA             PIC X(15).
                15 FILLER                           PIC X(01) VALUE '|'.
          05 WSV-LINEA-1.
             10 FILLER                         PIC X(10) VALUE 'ENERO'.
             10 WSV-ESTADISTICAS-ENE OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-ENE           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-2.
             10 FILLER                        PIC X(10) VALUE 'FEBRERO'.
               10 WSV-ESTADISTICAS-FEB OCCURS 50 TIMES.
                  15 WSV-VALOR-EST-FEB           PIC $$$.$$$.$$9,99.
                  15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-3.
             10 FILLER                         PIC X(10) VALUE 'MARZO'.
               10 WSV-ESTADISTICAS-MAR OCCURS 50 TIMES.
                  15 WSV-VALOR-EST-MAR           PIC $$$.$$$.$$9,99.
                  15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-4.
             10 FILLER                         PIC X(10) VALUE 'ABRIL'.
               10 WSV-ESTADISTICAS-ABR OCCURS 50 TIMES.
                  15 WSV-VALOR-EST-ABR           PIC $$$.$$$.$$9,99.
                  15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-5.
             10 FILLER                           PIC X(10) VALUE 'MAYO'.
             10 WSV-ESTADISTICAS-MAY OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-MAY           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-6.
             10 FILLER                         PIC X(10) VALUE 'JUNIO'.
             10 WSV-ESTADISTICAS-JUN OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-JUN           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-7.
             10 FILLER                         PIC X(10) VALUE 'JULIO'.
             10 WSV-ESTADISTICAS-JUL OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-JUL           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-8.
             10 FILLER                         PIC X(10) VALUE 'AGOSTO'.
             10 WSV-ESTADISTICAS-AGO OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-AGO           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-9.
             10 FILLER                     PIC X(10) VALUE 'SEPTIEMBRE'.
             10 WSV-ESTADISTICAS-SEP OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-SEP           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-10.
             10 FILLER                        PIC X(10) VALUE 'OCTUBRE'.
             10 FILLER                      PIC X(10) VALUE 'NOVIEMBRE'.
             10 WSV-ESTADISTICAS-OCT OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-OCT           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-11.
             10 WSV-ESTADISTICAS-NOV OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-NOV           PIC $$$.$$$.$$9,99.
                 15 FILLER                      PIC X(01) VALUE '|'.
          05 WSV-LINEA-12.
             10 FILLER                      PIC X(10) VALUE 'DICIEMBRE'.
             10 WSV-ESTADISTICAS-DIC OCCURS 50 TIMES.
                 15 WSV-VALOR-EST-DIC          PIC $$$.$$$.$$9,99.
                 15 FILLER                     PIC X(01) VALUE '|'.
      *--------------------------------------------------------- *
       PROCEDURE DIVISION.
       000000-CONTROL.
           PERFORM 100000-INICIO
           PERFORM 200000-LECTURA-INICIAL
           PERFORM 300000-CARGAR-ORDENAR-TAB-CAT
           PERFORM 400000-PROCESAR UNTIL WSS-FS-VIP-EOF
                                AND WSS-FS-RES1-EOF
                                AND WSS-FS-RES2-EOF 
                                AND WSS-FS-RES3-EOF
           PERFORM 500000-FIN
           STOP RUN.
      ***********************  INICIO  ***************************
       100000-INICIO.
           PERFORM 900000-ABRIR-REPORTE
           PERFORM 110000-GRABAR-CABECERA-REPORTE
           PERFORM 901000-ABRIR-MATRIZ
           PERFORM 902000-ABRIR-RESERV1
           PERFORM 903000-ABRIR-RESERV2
           PERFORM 904000-ABRIR-RESERV3
           PERFORM 905000-ABRIR-RESERVIP
           PERFORM 906000-ABRIR-ESTADIAS
           PERFORM 907000-ABRIR-CATGRIAS
           PERFORM 908000-ABRIR-DSCENTOS
           PERFORM 909000-ABRIR-MAESTRO.
      *********************  LECTURA-INICIAL  ********************
       200000-LECTURA-INICIAL.
            PERFORM 912000-LEER-RES1.
            PERFORM 913000-LEER-RES2.
            PERFORM 914000-LEER-RES3.
            PERFORM 915000-LEER-VIP.
            PERFORM 916000-LEER-EST.
            PERFORM 917000-LEER-CAT.
            PERFORM 918000-LEER-DESC.
      ******************  CARGA-Y-ORDENA-TAB-CAT *****************
       300000-CARGAR-ORDENAR-TAB-CAT.
           PERFORM 310000-CARGAR-TABLA UNTIL WSS-FS-CAT-EOF 
                                             OR WSI-SUB > 50.
           PERFORM 320000-ORDENAR-TABLA-CATGRIAS.
      *    PERFORM 936000-CERRAR-ARCH-CATGRIAS.
      *******************
       310000-CARGAR-TABLA.
           MOVE CAT TO WSV-TABLA-CATGRIAS(WSI-SUB)
           ADD 1 TO WSI-SUB
           PERFORM 917000-LEER-CAT.
      *******************
       320000-ORDENAR-TABLA-CATGRIAS.
           PERFORM VARYING WSI-I FROM 1 BY 1 UNTIL WSI-I = WSI-SUB + 1
              PERFORM VARYING WSI-J FROM WSI-I BY 1 UNTIL
                                                       WSI-J > WSI-SUB
                 IF WSV-TBL-CAT-HB(WSI-J) < WSV-TBL-CAT-HB(WSI-I) THEN
                    MOVE WSV-TABLA-CATGRIAS(WSI-I)  TO WSV-TBL-HLD
                    MOVE WSV-TABLA-CATGRIAS(WSI-J)  TO
                                            WSV-TABLA-CATGRIAS(WSI-I)
                    MOVE WSV-TBL-HLD TO WSV-TABLA-CATGRIAS(WSI-J)
                 END-IF
              END-PERFORM
           END-PERFORM.
      *********************** PROCESO ****************************
       400000-PROCESAR.
           PERFORM 410000-DETERMINAR-MENOR
           PERFORM 420000-POSIBLE-RES-N
           PERFORM 430000-POSIBLE-RES-VIP
           PERFORM 450000-CHEQUEAR-ESTADIA
           PERFORM 460000-APLICAR-DESCUENTO
           PERFORM 929000-GRABAR-MAESTRO
           PERFORM 470000-PROCESAR-REPO-ACEPTADA.
      *********************** DETERMINAR-MENOR *******************
       410000-DETERMINAR-MENOR.
               MOVE REG-RES-VIP-CLAVE TO WS-MENOR
               IF WS-MENOR > REG-RES1-CLAVE
                   MOVE REG-RES1-CLAVE TO WS-MENOR
               END-IF
               IF WS-MENOR > REG-RES2-CLAVE
                   MOVE REG-RES2-CLAVE TO WS-MENOR
               END-IF
               IF WS-MENOR > REG-RES3-CLAVE
                   MOVE REG-RES3-CLAVE TO WS-MENOR
               END-IF.
      *********************** POSIBLE-RES-N **********************
       420000-POSIBLE-RES-N.
           PERFORM 421000-POSIBLE-RES-1
           PERFORM 422000-POSIBLE-RES-2
           PERFORM 423000-POSIBLE-RES-3.
      *********************** POSIBLE-RES-1 **********************
       421000-POSIBLE-RES-1.
           IF WS-MENOR = REG-RES1-CLAVE
              PERFORM 421100-OBTENER-ULT-MODIF-RES1 UNTIL
              WS-MENOR NOT = REG-RES1-CLAVE OR WSS-FS-RES1-EOF
              MOVE 'N' TO WS-REG-MAE-ESTADO
              IF WSS-FS-RES1-EOF
                 MOVE 999999      TO REG-RES1-COD-RES
                 MOVE 9           TO REG-RES1-DIGITO
              END-IF.
      ****************** OBTENER-ULT-MODIF-RES1 ***************
       421100-OBTENER-ULT-MODIF-RES1.
           MOVE REG-RES1 TO WS-REG.
           PERFORM 912000-LEER-RES1.
      *********************** POSIBLE-RES-2 **********************
       422000-POSIBLE-RES-2.
           IF WS-MENOR = REG-RES2-CLAVE
              PERFORM 422100-OBTENER-ULT-MODIF-RES2
              MOVE 'N' TO WS-REG-MAE-ESTADO
              IF WSS-FS-RES2-EOF
                 MOVE 999999      TO REG-RES2-COD-RES
                 MOVE 9           TO REG-RES2-DIGITO
              END-IF.
      ****************** OBTENER-ULT-MODIF-RES2 ***************
       422100-OBTENER-ULT-MODIF-RES2.
           MOVE REG-RES2 TO WS-REG.
           PERFORM 913000-LEER-RES2.
      *********************** POSIBLE-RES-3 **********************
       423000-POSIBLE-RES-3.
           IF WS-MENOR = REG-RES3-CLAVE
              PERFORM 423100-OBTENER-ULT-MODIF-RES3
              MOVE 'N' TO WS-REG-MAE-ESTADO
              IF WSS-FS-RES3-EOF
                 MOVE 999999      TO REG-RES3-COD-RES
                 MOVE 9           TO REG-RES3-DIGITO
              END-IF.
      ****************** OBTENER-ULTIMA-MODIF ********************
       423100-OBTENER-ULT-MODIF-RES3.
           MOVE REG-RES3 TO WS-REG.
           PERFORM 914000-LEER-RES3.
      ********************** POSIBLE-RES-VIP *********************
       430000-POSIBLE-RES-VIP.
           IF WS-MENOR = REG-RES-VIP-CLAVE
              PERFORM 431000-OBTENER-ULT-MODIF-VIP UNTIL
              WS-MENOR NOT = REG-RES-VIP-CLAVE OR WSS-FS-VIP-EOF
              MOVE 'N' TO WS-REG-MAE-ESTADO
              IF WSS-FS-VIP-EOF
                 MOVE 999999      TO REG-RES-VIP-COD-RES
                 MOVE 9           TO REG-RES-VIP-DIGITO
              END-IF.
      ****************** OBTENER-ULT-MODIF-VIP ****************
       431000-OBTENER-ULT-MODIF-VIP.
           MOVE REG-RES-VIP TO WS-REG
           PERFORM 915000-LEER-VIP.
      ********************** CHEQUEAR-ESTADIA ********************
       450000-CHEQUEAR-ESTADIA.
           PERFORM 916000-LEER-EST UNTIL WS-MENOR <= WS-REG-EST-CLAVE
                                        OR WSS-FS-EST-EOF
           IF WS-MENOR = WS-REG-EST-CLAVE
              MOVE WS-REG-EST-FECHA-DES TO WS-REG-MAE-FECHA-DES
              MOVE WS-REG-EST-FECHA-HAS TO WS-REG-MAE-FECHA-HAS
              MOVE WS-REG-EST-CATEG-HAB TO WS-REG-MAE-CATEG-HAB
              ADD WS-REG-EST-IMPORTE TO WS-REG-MAE-IMP
              MOVE 'A' TO WS-REG-MAE-ESTADO
           END-IF.
      ********************** APLICAR-DESCUENTO *******************
       460000-APLICAR-DESCUENTO.
            IF WS-MENOR = WS-REG-DESC-CLAVE
               COMPUTE WS-DESC = (WS-REG-MAE-IMP * 100)/
               WS-REG-DESC-PORC
               SUBTRACT WS-DESC FROM WS-REG-MAE-IMP
               PERFORM 918000-LEER-DESC
            END-IF.
      ******************* PROCESAR-REPORTE-ACEPTADA **************
       470000-PROCESAR-REPO-ACEPTADA.
            IF WS-REG-MAE-ESTADO = 'A'
               PERFORM 471000-CARGAR-REPORTE
               PERFORM 930000-GRABAR-REPORTE
               PERFORM 472000-CARGAR-MATRIZ
            END-IF.
      **************
       472000-CARGAR-MATRIZ.
           MOVE WS-REG-MAE-MES-DES    TO WSI-X.
           MOVE WSV-TBL-CAT-HB(WSI-I) TO WSI-Y.
           ADD WS-REG-MAE-IMP TO WSV-IMPORTE-MATRIZ(WSI-X,WSI-Y).
      ***************
       110000-GRABAR-CABECERA-REPORTE.
           MOVE WSV-FECHA-DEL-DIA-AAAA  TO WSV-FEC-LISTADO-RESERVAS-AAAA. 
           MOVE WSV-FECHA-DEL-DIA-MM    TO WSV-FEC-LISTADO-RESERVAS-MM.
           MOVE WSV-FECHA-DEL-DIA-DD    TO WSV-FEC-LISTADO-RESERVAS-DD.
           MOVE WSI-PAGINA              TO WSV-NUMERO-HOJA.
           MOVE WSV-LINEA-UNO           TO REGISTRO-REPORTE.
           PERFORM 930000-GRABAR-REPORTE.
           MOVE WSV-LINEA-DOS           TO REGISTRO-REPORTE.
           PERFORM 930000-GRABAR-REPORTE.
           MOVE WSV-LINEA-TRES          TO REGISTRO-REPORTE.
           PERFORM 930000-GRABAR-REPORTE.
      *******************
       471000-CARGAR-REPORTE.
           IF WSI-LINEA > WSC-MAX-LINEA
              ADD WSC-N-1 TO WSI-PAGINA
              MOVE WSC-N-1              TO WSI-LINEA
              PERFORM 110000-GRABAR-CABECERA-REPORTE
           ELSE
              MOVE WS-REG-MAE-COD-RES         TO WSV-CODIGO
              MOVE WS-REG-MAE-DIGITO          TO WSV-DIGITO
              MOVE WS-REG-MAE-FECHA-DES       TO WSV-FEC-DES
              MOVE WS-REG-MAE-FECHA-HAS       TO WSV-FEC-HAS
              MOVE WSV-TBL-CAT-DESC(WSI-I)    TO WSV-CATEGORIA
              MOVE WS-REG-MAE-IMP             TO WSV-IMPORTE
              MOVE WS-REG-MAE-NOMBRE-CLI      TO WSV-NOMB-CLIE
              MOVE WSV-LINEA-CUATRO           TO REGISTRO-REPORTE
              PERFORM 930000-GRABAR-REPORTE
           END-IF.
      *******************
       473000-PREPARA-MATRIZ.
           PERFORM VARYING WSI-I FROM 1 BY 1 UNTIL WSI-I > 50
             MOVE WSV-TBL-CAT-DESC(WSI-I) TO WSV-CATEGORIA-SALIDA(WSI-I)
           END-PERFORM
           MOVE WSV-LINEA-0    TO REGISTRO-MATRIZ.
           PERFORM 931000-GRABAR-MATRIZ.

           PERFORM VARYING WSI-I FROM 1 BY 1 UNTIL WSI-I > 50
              MOVE WSV-IMPORTE-MATRIZ (1,WSI-I)
              TO WSV-VALOR-EST-ENE(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (2,WSI-I)
              TO WSV-VALOR-EST-FEB(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (3,WSI-I)
              TO WSV-VALOR-EST-MAR(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (4,WSI-I)
              TO WSV-VALOR-EST-ABR(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (5,WSI-I)
              TO WSV-VALOR-EST-MAY(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (6,WSI-I)
              TO WSV-VALOR-EST-JUN(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (7,WSI-I)
              TO WSV-VALOR-EST-JUL(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (8,WSI-I)
              TO WSV-VALOR-EST-AGO(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (9,WSI-I)
              TO WSV-VALOR-EST-SEP(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (10,WSI-I)
              TO WSV-VALOR-EST-OCT(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (11,WSI-I)
              TO WSV-VALOR-EST-NOV(WSI-I)
              MOVE WSV-IMPORTE-MATRIZ (12,WSI-I)
              TO WSV-VALOR-EST-DIC(WSI-I)
           END-PERFORM
           MOVE WSV-LINEA-1    TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-2     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-3     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-4     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-5     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-6     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-7     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-8   TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-9     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-10     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-11     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ
           MOVE WSV-LINEA-12     TO REGISTRO-MATRIZ
           PERFORM 931000-GRABAR-MATRIZ.
      ************************  FIN  *****************************
       500000-FIN.
           PERFORM 473000-PREPARA-MATRIZ
           PERFORM 940000-CERRAR-REPORTE
           PERFORM 941000-CERRAR-MATRIZ
           PERFORM 942000-CERRAR-RESERV1
           PERFORM 943000-CERRAR-RESERV2
           PERFORM 944000-CERRAR-RESERV3
           PERFORM 945000-CERRAR-RESERVIP
           PERFORM 946000-CERRAR-ESTADIAS
           PERFORM 947000-CERRAR-CATGRIAS
           PERFORM 948000-CERRAR-DSCENTOS
           PERFORM 949000-CERRAR-MAESTRO
           STOP RUN.
      **************
       999999-ERROR.
           STOP RUN.
      *******************  ABRIR REPORTE  *************************
       900000-ABRIR-REPORTE.
           OPEN OUTPUT REPORTE.
        EVALUATE TRUE 
              WHEN WSS-FS-REPORTE-OK
                 CONTINUE
              WHEN OTHER           
                 DISPLAY 'ERROR EN OPEN REPORTE FS: ' WSS-FS-REPORTE
                 PERFORM 999999-ERROR
           END-EVALUATE.
      *******************  ABRIR MATRIZ  *************************
       901000-ABRIR-MATRIZ.
           OPEN OUTPUT MATRIZ.
        EVALUATE TRUE 
              WHEN WSS-FS-MATRIZ-OK
                 CONTINUE
              WHEN OTHER           
                 DISPLAY 'ERROR EN OPEN MATRIZ FS: ' WSS-FS-REPORTE
                 PERFORM 999999-ERROR
           END-EVALUATE.
      ******************  ABRIR RESERVAS 1  **********************
       902000-ABRIR-RESERV1.
           OPEN INPUT RESERV1
           IF WSS-FS-RES1 NOT = '00'
              DISPLAY 'ERROR EN OPEN RESERVAS 1. FS: ' WSS-FS-RES1
              PERFORM 999999-ERROR
           END-IF.
      ******************  ABRIR RESERVAS 2  **********************
       903000-ABRIR-RESERV2.
           OPEN INPUT RESERV2.
           IF WSS-FS-RES2 NOT = '00'
              DISPLAY 'ERROR EN OPEN RESERVAS 2. FS: ' WSS-FS-RES2
              PERFORM 999999-ERROR
           END-IF.
      ******************  ABRIR RESERVAS 3  **********************
       904000-ABRIR-RESERV3.
           OPEN INPUT RESERV3.
           IF WSS-FS-RES3 NOT = '00'
              DISPLAY 'ERROR EN OPEN RESERVAS 3. FS: ' WSS-FS-RES3
              PERFORM 999999-ERROR
           END-IF.
      *****************  ABRIR RESERVAS VIP  *********************
       905000-ABRIR-RESERVIP.
           OPEN INPUT RESERVIP.
           IF WSS-FS-VIP NOT = '00'
              DISPLAY 'ERROR EN OPEN RESERVAS VIP. FS: ' WSS-FS-VIP
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR ESTADIAS  ***********************
       906000-ABRIR-ESTADIAS.
           OPEN INPUT ESTADIAS.
           IF WSS-FS-EST NOT = '00'
              DISPLAY 'ERROR EN OPEN ESTADIAS. FS: ' WSS-FS-EST
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR CATGRIAS ***********************
       907000-ABRIR-CATGRIAS.
           OPEN INPUT CATGRIAS.
           IF WSS-FS-CAT NOT = '00'
              DISPLAY 'ERROR EN OPEN CATGRIAS. FS: ' WSS-FS-CAT
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR DSCENTOS ***********************
       908000-ABRIR-DSCENTOS.
           OPEN INPUT DSCENTOS.
           IF WSS-FS-DESC NOT = '00'
              DISPLAY 'ERROR EN OPEN DSCENTOS. FS: ' WSS-FS-DESC
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR MAESTRO  ***********************
       909000-ABRIR-MAESTRO.
           OPEN OUTPUT MAESTRO.
           IF WSS-FS-EST NOT = '00'
              DISPLAY 'ERROR EN OPEN MAESTRO FS: ' WSS-FS-MAESTRO
              PERFORM 999999-ERROR
           END-IF.
      *********************** LEO-RES1 ***************************
       912000-LEER-RES1.
           READ RESERV1
              AT END SET WSS-FS-RES1-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-RES1-OK
                 ADD 1 TO WSV-LEIDOS-RES1
              WHEN WSS-FS-RES1-EOF
                 IF WSV-LEIDOS-RES1 EQUAL ZEROES
                    DISPLAY 'ARCHIVO RES1 VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA RES1. FS: ' WSS-FS-RES1
				 PERFORM 999999-ERROR
           END-EVALUATE.
      *********************** LEO-RES2 ***************************
       913000-LEER-RES2.
           READ RESERV2
              AT END SET WSS-FS-RES2-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-RES2-OK
                ADD 1 TO WSV-LEIDOS-RES2
              WHEN WSS-FS-RES2-EOF
                 IF WSV-LEIDOS-RES2 EQUAL ZEROES
                    DISPLAY 'ARCHIVO RES2 VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA RES2. FS: ' WSS-FS-RES2  
				 PERFORM 999999-ERROR				 
           END-EVALUATE.
      *********************** LEO-RES3 ***************************
       914000-LEER-RES3.
           READ RESERV3
              AT END SET WSS-FS-RES3-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-RES3-OK
                ADD 1 TO WSV-LEIDOS-RES3
              WHEN WSS-FS-RES3-EOF
                 IF WSV-LEIDOS-RES3 EQUAL ZEROES
                    DISPLAY 'ARCHIVO RES3 VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA RES3. FS: ' WSS-FS-RES3     
				 PERFORM 999999-ERROR				 
           END-EVALUATE.
      *********************** LEO-VIP ****************************
       915000-LEER-VIP.
           READ RESERVIP
              AT END SET WSS-FS-VIP-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-VIP-OK
                ADD 1 TO WSV-LEIDOS-VIP
              WHEN WSS-FS-VIP-EOF
                 IF WSV-LEIDOS-VIP EQUAL ZEROES
                    DISPLAY 'ARCHIVO VIP VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA VIP. FS: ' WSS-FS-VIP
				 PERFORM 999999-ERROR				 
           END-EVALUATE. 
      *********************** LEO-EST ***************************
       916000-LEER-EST.
           READ ESTADIAS
              AT END SET WSS-FS-EST-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-EST-OK
                ADD 1 TO WSV-LEIDOS-EST
              WHEN WSS-FS-EST-EOF
                 IF WSV-LEIDOS-EST EQUAL ZEROES
                    DISPLAY 'ARCHIVO EST VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                DISPLAY 'ERROR LECTURA EST. FS: ' WSS-FS-EST 
				PERFORM 999999-ERROR				
           END-EVALUATE.
		   display 'fs: ' WSS-FS-EST
		   display 'leidos: ' WSV-LEIDOS-EST.
      ************************ LEO-CAT ***************************
       917000-LEER-CAT.
           READ CATGRIAS INTO WS-REG-CAT
              AT END SET WSS-FS-CAT-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-CAT-OK
                ADD 1 TO WSV-LEIDOS-CAT
              WHEN WSS-FS-CAT-EOF
                 IF WSV-LEIDOS-CAT EQUAL ZEROES
                    DISPLAY 'ARCHIVO CAT VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA CAT. FS: ' WSS-FS-CAT  
				 PERFORM 999999-ERROR				 
           END-EVALUATE.
      ************************ LEO-DESC **************************
       918000-LEER-DESC.
           READ DSCENTOS
              AT END SET WSS-FS-DESC-EOF TO TRUE.
           EVALUATE TRUE
              WHEN WSS-FS-DESC-OK
                ADD 1 TO WSV-LEIDOS-DESC
              WHEN WSS-FS-DESC-EOF
                 IF WSV-LEIDOS-DESC EQUAL ZEROES
                    DISPLAY 'ARCHIVO DESC VACIO'
					PERFORM 999999-ERROR
                 END-IF
              WHEN OTHER
                 DISPLAY 'ERROR LECTURA DESC. FS: ' WSS-FS-DESC 
				 PERFORM 999999-ERROR				 
           END-EVALUATE.
      ******************** GRABAR-EN-MAESTRO *******************
       929000-GRABAR-MAESTRO.
           MOVE WS-REG-MAE TO MAE
           WRITE MAE    
              AFTER ADVANCING 1 LINE.
           EVALUATE TRUE
              WHEN WSS-FS-MAESTRO-OK
                  CONTINUE
              WHEN OTHER
                  DISPLAY 'ERROR AL GRABAR MAESTRO. FS: ' 
                           WSS-FS-MAESTRO
                  PERFORM 999999-ERROR
           END-EVALUATE.                      
      ******************** GRABAR-EN-REPORTE *******************
       930000-GRABAR-REPORTE.
           WRITE REGISTRO-REPORTE
              AFTER 1 LINE.
           EVALUATE TRUE
              WHEN WSS-FS-REPORTE-OK
                  CONTINUE
              WHEN OTHER
                  DISPLAY 'ERROR AL GRABAR REPORTE. FS: ' 
                          WSS-FS-REPORTE              
                  PERFORM 999999-ERROR
           END-EVALUATE.           
      ******************** GRABAR-EN-MATRIZ *******************
       931000-GRABAR-MATRIZ.
           WRITE REGISTRO-MATRIZ
              AFTER ADVANCING 1 LINE.
           EVALUATE TRUE
           WHEN WSS-FS-MATRIZ-OK
               CONTINUE
           WHEN OTHER
               DISPLAY 'ERROR AL GRABAR MATRIZ. FS: ' 
                         WSS-FS-MATRIZ
               PERFORM 999999-ERROR
           END-EVALUATE.
      *********************** CERRAR REPORTE *********************
       940000-CERRAR-REPORTE.
           CLOSE REPORTE.
           IF WSS-FS-REPORTE NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE REPORTE FS: ' WSS-FS-REPORTE
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR MATRIZ  *************************
       941000-CERRAR-MATRIZ.
           CLOSE MATRIZ.
           IF WSS-FS-MATRIZ NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE MATRIZ FS: ' WSS-FS-MATRIZ
              PERFORM 999999-ERROR
           END-IF.
      ******************  ABRIR RESERVAS 1  **********************
       942000-CERRAR-RESERV1.
           CLOSE RESERV1
           IF WSS-FS-RES1 NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE RESERVAS 1. FS: ' WSS-FS-RES1
              PERFORM 999999-ERROR
           END-IF.
      ******************  ABRIR RESERVAS 2  **********************
       943000-CERRAR-RESERV2.
           CLOSE RESERV2.
           IF WSS-FS-RES2 NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE RESERVAS 2. FS: ' WSS-FS-RES2
              PERFORM 999999-ERROR
           END-IF.
      ******************  ABRIR RESERVAS 3  **********************
       944000-CERRAR-RESERV3.
           CLOSE RESERV3.
           IF WSS-FS-RES3 NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE RESERVAS 3. FS: ' WSS-FS-RES3
              PERFORM 999999-ERROR
           END-IF.
      *****************  ABRIR RESERVAS VIP  *********************
       945000-CERRAR-RESERVIP.
           CLOSE RESERVIP.
           IF WSS-FS-VIP NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE RESERVAS VIP. FS: ' WSS-FS-VIP
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR ESTADIAS  ***********************
       946000-CERRAR-ESTADIAS.
           CLOSE ESTADIAS.
           IF WSS-FS-EST NOT = ZERO
              DISPLAY 'ERROR EN CLOSE ESTADIAS. FS: ' WSS-FS-EST
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR CATGRIAS ***********************
       947000-CERRAR-CATGRIAS.
           CLOSE CATGRIAS.
           IF WSS-FS-CAT NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE CATGRIAS. FS: ' WSS-FS-CAT
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR DSCENTOS ***********************
       948000-CERRAR-DSCENTOS.
           CLOSE DSCENTOS.
           IF WSS-FS-DESC NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE DSCENTOS. FS: ' WSS-FS-DESC
              PERFORM 999999-ERROR
           END-IF.
      *******************  ABRIR MAESTRO  ***********************
       949000-CERRAR-MAESTRO.
           CLOSE MAESTRO.
           IF WSS-FS-EST NOT = ZEROES
              DISPLAY 'ERROR EN CLOSE MAESTRO FS: ' WSS-FS-MAESTRO
              PERFORM 999999-ERROR
           END-IF.

          
